<template>
	<view>
		<ul>
			<li v-for="i in postList" class="postli" @tap="liTap(i.id)"
				style="height: auto;border-bottom:1px solid #edeef2;padding: 10px 14px;">
				<view class="post-view" style="display: grid;grid-template-columns: 7fr 4fr;grid-gap: 10px;">
					<view class="post-left" style="display: grid;grid-template-rows: 3fr 1fr;">
						<view class="post-left-top">
							<p>{{i.title}}</p>
						</view>
						<view class="post-left-bottom"
							style="display: grid;grid-template-columns: auto 2fr;grid-gap: 8px;">
							<view class="post-author" style="max-width: 130px;">
								<p>{{i.author}}</p>
							</view>
							<view class="post-time">
								<p>{{i.time}}</p>
							</view>
						</view>
					</view>
					<view class="post-right" style="place-items:center end;display: grid;grid-template-rows: 10fr 2fr">
						<u--image :showLoading="true" :src="i.coverpic" width="130px" height="80px" radius="4">
						</u--image>
						<u-album :urls="i.coverpic"></u-album>
						<view class="readCount" style="margin-right: 5px;display: flex;">
							<u-icon width="18px" height="18px"
								name="https://notewk-1304925042.cos.ap-guangzhou.myqcloud.com/notewk/eye.png"
								color="#aeaeae" size="18"></u-icon>
							<p style="margin-left: 3px;margin-right: 10px;">{{i.readCount}}</p>
							<u-icon width="16px" height="14px"
								name="https://notewk-1304925042.cos.ap-guangzhou.myqcloud.com/notewk/star.png"
								color="#aeaeae" size="18"></u-icon>
							<p style="margin-left: 3px;">{{i.star}}</p>
						</view>
					</view>
				</view>
			</li>
		</ul>
		<u-back-top :scroll-top="scrollTop"
			icon="https://notewk-1304925042.cos.ap-guangzhou.myqcloud.com/notewk/上箭头.png" bottom="50">
		</u-back-top>
	</view>
</template>

<script>
	import {
		searchApi
	} from '@/utils/api.js'
	export default {
		data() {
			return {
				postList: {}
			}
		},
		onLoad(option) {
			var searchTitle = option.title
			searchApi(searchTitle).then((res) => {
				this.postList = res
			})

		},
		methods: {
			liTap(id) {
				console.log(id)
				uni.navigateTo({
					url: '/pages/content/content?id=' + id,
				})
			},
		}
	}
</script>

<style>
	.function-view {
		padding: 10rpx 0;
		width: 100%;
		display: grid;
		grid-template-columns: repeat(5, 1fr);
		grid-column-gap: 12px;
		grid-row-gap: 10px;
	}

	.function-view-item {
		display: grid;
		grid-template-rows: 7fr 2fr;
	}

	.function-view-item-pic {
		position: relative;
	}

	.function-view-item-text {}

	.function-view-item-img {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		width: 105rpx;
		height: 105rpx;
	}

	.post-left-bottom {
		margin-top: 7px;
	}

	.post-left-top p {
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 3;
		-webkit-box-orient: vertical;
		font-size: 18px;
		color: #353b48;
		margin-top: 1px;
		letter-spacing: 1px;
		line-height: 1.5;
	}

	.post-author p {
		font-size: 13px;
		color: #999999;
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
	}

	.post-time p {
		font-size: 13px;
		color: #999999;
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
	}

	.readCount p {
		font-size: 13px;
		color: #aeaeae;
	}

	.u-back-top {
		background-color: #74BE9B !important;
	}
</style>
